<template>
    <div class="easyd-weixin-Box">

        <div class="app_page">
            <div class="objection_list app_box_content_list app_list_box MARGIN_BOTTOM_10" v-for="item in feedbackData"
                 @click="replyObjection(item)">
                <div class="objection_info">
                    <div class="app_box_flex MARGIN_BOTTOM_5">
                        <div class="app_box_content_left app_box_flex_5" style="overflow:hidden;">
                            {{item.sq_content}}
                        </div>
                        <div class="app_box_content_right" style="color: #00ff1e;">
                            <span class="T2" v-if="item.sq_apply_knowledge_status == 1" style="color: #999999">待审核</span>
                            <span class="T2" v-else-if="item.sq_apply_knowledge_status == 2" style="color: #999999">已同意</span>
                            <span class="T2" v-else-if="item.sq_apply_knowledge_status == 3" style="color: #999999">已拒绝</span>
                            <span class="T2" v-else style="color: #3aff56"></span>
                        </div>
                    </div>

                    <ul class="MARGIN_BOTTOM_5" v-if="item.new_sq_reply != null">
                        <li class=" T4 C4" v-for="textItem in item.new_sq_reply" v-if="textItem.type == '0'" v-html="textItem.txt"></li>
                    </ul>

                </div>
                <div class="objection_time C2 T3">
                    <span class="app_float_left">反馈时间：{{$common.getTimes(item.sq_create_time,'cn')}}</span>
                    <span class="app_float_right">{{feedbackTypeArr[item.sq_type]}}</span>
                </div>
            </div>
        </div>

    </div>
</template>

<script>
    import {mapState, mapMutations} from "vuex";

    export default {

        data() {
            return {
                feedbackTypeArr: ['行业知识', '产品知识', '销售技巧'], //反馈类型
            };
        },
        computed: {
            ...mapState({
                feedbackData: state => state.ObjectionFeedbackListModule.feedbackData,
            }),
        },
        mounted() {
            this.initData()

        },
        methods: {

            //  ...mapMutations(["ShopIndexModule/updateIsShopGuide"]),

            initData() {

                var uids = this.$userData.getUID();
                
                var aipUrl = '';
                aipUrl = this.$API.questionsToBeAudited;

                this.$easyUtil.startLoading(this);
                this.$http.getHttp(
                    aipUrl,
                    rs => {

                        console.log(rs);
                        for(var i=0;i<rs.waitingSaveAsKnowledge.length;i++){
                        	if(rs.waitingSaveAsKnowledge[i].sq_reply == null || rs.waitingSaveAsKnowledge[i].sq_reply == ''){
                        		rs.waitingSaveAsKnowledge[i].new_sq_reply = [];
                        	}else{
                        		rs.waitingSaveAsKnowledge[i].sq_reply = rs.waitingSaveAsKnowledge[i].sq_reply.replace(/\n/g,'<br/>');
                        		rs.waitingSaveAsKnowledge[i].new_sq_reply = JSON.parse(rs.waitingSaveAsKnowledge[i].sq_reply);
                        	}
                        }
                        this.$store.commit("ObjectionFeedbackListModule/updateFeedbackData", rs.waitingSaveAsKnowledge);
                        this.$easyUtil.endLoading(this)

                    }
                );
            },

            //回复反馈
            replyObjection(item) {
                this.$easyUtil.GO(this, '/lookObjection', {sq_id: item.sq_id,type:'shenhe'})
            },
        }
    };
</script>

<style lang="stylus" scoped>
    @import '~PUBLIC_CSS';
    .objection_list {
        overflow: hidden;
        line-height: 22px;
    }

    .objection_list .objection_info {
        float: initial;
    }

    .objection_list .objection_info ul {
        line-height: 20px;
        list-style: none;
    }

    .objection_list .objection_info ul li {
    }

    .objection_list .objection_time {
        overflow: hidden;
        width: 100%;
    }

    .objection_list .objection_time .app_float_right {
        color: #fbd415;
    }
</style>